#pragma once

#include <vector>
#include <set>
#include <queue>
#include <string>
#include "llvm/Module.h"
#include "llvm/Function.h"
#include "llvm/BasicBlock.h"
#include "llvm/Instruction.h"
#include "llvm/Type.h"
#include "llvm/DerivedTypes.h"
#include "llvm/ExecutionEngine/JIT.h"
#include "llvm/Instructions.h"
#include "PrefetchProfiler.h"
#include <sys/types.h>
#include <sys/mman.h>

using namespace llvm;
using namespace std;

typedef Instrumenter<LoadInst, PrefetchProfiler, void*> PrefetchBase;

struct PrefetchInstrumenter : public PrefetchBase
{
	PrefetchInstrumenter(Module *M, ExecutionEngine *EE) : PrefetchBase(M, EE) { }
	const Type* getArgType() { return Type::getInt8PtrTy(C); }

	Value* InstrumentThis(LoadInst *Inst) {
		return new BitCastInst(Inst->getOperand(0), Type::getInt8PtrTy(C), "", Inst);
	}
};
